package com.online.usermanagesystem.controller;

import com.online.usermanagesystem.entity.Config;
import com.online.usermanagesystem.service.ConfigManageService;
import com.online.usermanagesystem.utils.accessrule.Rule;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 企业信息管理控制器
 *
 * @author jhk
 * @create 2018-04-24 11:10
 */
@RestController
@RequestMapping(value = "/config")
public class ConfigManageController {

    @Autowired
    private ConfigManageService configManageService;

    @RequestMapping(value = "/get", method = RequestMethod.GET)
    public Object get(String type, Integer owner) {
        return configManageService.get(type, owner);
    }

    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public Object list(Integer owner) {
        return configManageService.list(owner);
    }

    @RequestMapping(value = "/set", method = RequestMethod.POST)
    public Object set(Config config) {
        return configManageService.set(config);
    }

    @RequestMapping(value = "/del", method = RequestMethod.POST)
    public Object del(Integer id) {
        return configManageService.del(id);
    }

    @RequestMapping(value = "/json_get", method = RequestMethod.POST)
    public Object jsonGet(String type, Integer owner, String child) {
        return configManageService.jsonGet(type, owner, child);
    }

    @RequestMapping(value = "/json_set", method = RequestMethod.POST)
    public Object jsonSet(Integer id, String child, String data) {
        return configManageService.jsonSet(id, child, data);
    }

    @RequestMapping(value = "/json_del", method = RequestMethod.POST)
    public Object jsonDel(Integer id, String child) {
        return configManageService.jsonDel(id, child);
    }
}
